package com.ks.network.controller;


import com.ks.core.base._ControllerBase;
import com.ks.core.core.Result;
import com.ks.core.dto.OperateBase;
import com.ks.core.dto.SearchCriteriaBase;
import com.ks.network.entity.BNetworkBase;
import com.ks.network.service.IBNetworkBaseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <p>
 * 服务网点-网点基本信息表 前端控制器
 * </p>
 *
 * @author kingdee123
 * @since 2020-12-21
 */
@RestController
@RequestMapping("/bNetworkBase")
@Api(value = "管理模块", description = "管理模块")
public class BNetworkBaseController extends _ControllerBase {

    @Autowired
    private IBNetworkBaseService bNetworkBaseService;


    @PostMapping("/addNetWork")
    @ApiOperation(value = "服务网点添加接口", notes = "服务网点添加接口")
    public Object addNetWork(@RequestBody BNetworkBase bNetworkBase) {
        int resultMap = bNetworkBaseService.addNetWork(getContext(), bNetworkBase);
        return Result.success(resultMap);
    }

    @PostMapping("/updateNetWork")
    @ApiOperation(value = "服务网点修改接口", notes = "服务网点修改接口")
    public Object updateNetWork(@RequestBody BNetworkBase bNetworkBase) {
        int resultMap = bNetworkBaseService.updateNetWork(getContext(), bNetworkBase);
        return Result.success(resultMap);
    }

    @PostMapping("/selectNetWork")
    @ApiOperation(value = "服务网点详情查询接口", notes = "服务网点详情查询接口")
    public Object selectNetWork(@RequestBody BNetworkBase bNetworkBase) {
        Map<String, Object> resultMap = bNetworkBaseService.selectNetWork(getContext(), bNetworkBase);
        return Result.success(resultMap);
    }

    @PostMapping("/selectNetWorkList")
    @ApiOperation(value = "服务网点列表查询接口", notes = "fields查询搜索条件:state(状态),name(网点名称),area(省市区)")
    public Object selectNetWorkList(@RequestBody SearchCriteriaBase searchCriteriaBase) {
        Map<String, Object> resultMap = bNetworkBaseService.selectNetWorkList(getContext(), searchCriteriaBase);
        return Result.success(resultMap);
    }

    @PostMapping("/getBNetworkBaseUserCount")
    @ApiOperation(value = "租户网点服务数", notes = "租户网点服务数")
    public Object getBNetworkBaseUserCount() {
        Map<String, Object> bNetworkBaseUserCount = bNetworkBaseService.getBNetworkBaseUserCount(getContext());
        return Result.success(bNetworkBaseUserCount);
    }


    @PostMapping("/getBNetworkMapUserCount")
    @ApiOperation(value = "租户服务网点地图", notes = "租户服务网点地图")
    public Object getBNetworkMapUserCount() {
        Map<String, Object> bNetworkBaseUserCount = bNetworkBaseService.getBNetworkMapUserCount(getContext());
        return Result.success(bNetworkBaseUserCount);
    }


    @PostMapping("/deleteNetWork")
    @ApiOperation(value = "服务网点删除接口", notes = "服务网点删除接口")
    public Object deleteNetWork(@RequestBody OperateBase operateBase) {
        int resultMap = bNetworkBaseService.deleteNetWork(getContext(), operateBase);
        return Result.success(resultMap);
    }

/***********************************************************************************************************/
/*@PostMapping("/selectNetwork")
@ApiOperation(value = "服务网点查询接口", notes = "通过iCity和iArea查询")
public Object selectNetwork(@RequestBody SearchCriteriaBase searchCriteriaBase){
    Map<String, Object> resultMap = ibNetworkBaseService.selectNetWork(getContext(),searchCriteriaBase);
    return Result.success(resultMap);
}
    @PostMapping("/selectNetworkDetails")
    @ApiOperation(value = "服务网点详情查询接口", notes = "通过iNetName来查询网点详情")
    public Object selectNetworkDetails(@RequestBody NetworkRequest networkRequest){
        BNetworkBase networkBase = ibNetworkBaseService.selectNetworkDetails(getContext(),networkRequest.getINetName());
        return Result.success(networkBase);
    }*/

}

